package com.gnerv.sylvanas.business.manage.service.impl;

import com.gnerv.sylvanas.business.manage.service.VerifyService;
import com.gnerv.sylvanas.business.manage.storage.DictStorageService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author Gnerv LiGen
 */
@Slf4j
@Service
@AllArgsConstructor
public class DictParameterVerifyService implements VerifyService {

    private final DictStorageService dictStorageService;

    @Override
    public boolean verify(String attribute, Object value) {
        return dictStorageService.selectCountByDictCodeAndItemValue(attribute, String.valueOf(value)) >= 1;
    }

    public boolean status(String itemValue) {
        return dictStorageService.selectCountByDictCodeAndItemValue("status", itemValue) >= 1;
    }

}
